package com.qimou.iems.controller;

import com.qimou.iems.util.StatusConstant;
import com.qimou.iems.util.ViewData;
import com.zhuozhengsoft.pageoffice.OpenModeType;
import com.zhuozhengsoft.pageoffice.PageOfficeCtrl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Qimou Xie
 * @date 2018/5/6 15:40.
 **/
@Controller
@RequestMapping(value = "/test")
public class TestController extends BaseController {




    @RequestMapping(value = "/getHtml")
    public @ResponseBody ViewData getHtml(HttpServletRequest request){

        PageOfficeCtrl poCtrl=new PageOfficeCtrl(request);
        //设置服务器页面
        poCtrl.setServerPage(request.getContextPath()+"/poserver.zz");
        poCtrl.addCustomToolButton("保存", "Save()", 1);
        poCtrl.addCustomToolButton("打印", "PrintFile()", 6);
        poCtrl.addCustomToolButton("全屏/还原", "IsFullScreen()", 4);
        poCtrl.addCustomToolButton("关闭", "CloseFile()", 21);
        //设置保存页面
        poCtrl.setSaveFilePage("SaveFile.jsp");
        //打开Word文档
        poCtrl.webOpen("http://127.0.0.1:5888/resource/test.doc", OpenModeType.docNormalEdit,"张佚名");
        String htmlCode = poCtrl.getHtmlCode("PageOfficeCtrl1");
        return buildSuccessJson(StatusConstant.SUCCESS_CODE,"获取成功",
                htmlCode);
    }


}
